package Eyjafjalla.power;

import Eyjafjalla.card.AbstractEyjafjallaCard;
import Eyjafjalla.effect.MarkFireBreathEffect;
import Eyjafjalla.helper.EyjafjallaHelper;
import Eyjafjalla.modcore.EyjafjallaTag;
import Eyjafjalla.patch.CloudPatch;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.megacrit.cardcrawl.actions.common.ReducePowerAction;
import com.megacrit.cardcrawl.actions.utility.UseCardAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.helpers.ImageMaster;
import com.megacrit.cardcrawl.localization.PowerStrings;
import com.megacrit.cardcrawl.powers.AbstractPower;

public class FireMarkPower extends AbstractEyjafjallaPower {
    public static final String POWER_ID = "eyjafjalla:FireMarkPower";
    private static final PowerStrings powerStrings;

    public FireMarkPower(AbstractCreature owner, int amount){
        this.name = powerStrings.NAME;
        this.ID = POWER_ID;
        this.owner = owner;
        this.amount = amount;
        this.updateDescription();
        String path128 = "EyjafjallaResources/img/power/FireMarkPower_84.png";
        String path48 = "EyjafjallaResources/img/power/FireMarkPower_32.png";
        this.region128 = new TextureAtlas.AtlasRegion(ImageMaster.loadImage(path128),0,0,84,84);
        this.region48 = new TextureAtlas.AtlasRegion(ImageMaster.loadImage(path48),0,0,32,32);

        this.type = PowerType.BUFF;
    }

    public void onBeforeUseCard(AbstractCard card) {
        if(this.amount<=0)
            return;
        int exhaustAmt = EyjafjallaHelper.markCardToFire(card,this.amount);
        if(exhaustAmt>0){
            this.flashWithoutSound();
            addToTop(new ReducePowerAction(this.owner, this.owner, this, exhaustAmt));
            CardCrawlGame.sound.playA("ATTACK_FIRE", 0.3F);
        }
    }

    @Override
    public void updateDescription() {
        this.description = powerStrings.DESCRIPTIONS[0] + this.amount + powerStrings.DESCRIPTIONS[1];
    }

    static {
        powerStrings = CardCrawlGame.languagePack.getPowerStrings(POWER_ID);
    }
}

